package cn.flying.base.common.vo;

import java.io.Serializable;
import java.util.List;

import cn.flying.base.common.enums.RtCodeEnum;

/**
 * @description: 分页对象
 * @author: llyong
 * @date: 2019/12/14
 * @time: 20:27
 * @version: 1.0
 */
public class PageResponse<T> implements Serializable {
    private static final long serialVersionUID = 1L;

    /**
     * 响应吗
     */
    private String code;
    /**
     * 响应消息
     */
    private String msg;
    /**
     * 总计
     */
    private Long total;
    /**
     * 第几页
     */
    private Integer page;
    /**
     * 数据
     */
    private List<T> data;

    public PageResponse() {
    }

    public PageResponse(String code, String msg, Long total, List<T> data) {
        this.code = code;
        this.msg = msg;
        this.total = total;
        this.data = data;
    }

    public PageResponse(String code, String msg, Long total, Integer page, List<T> data) {
        this.code = code;
        this.msg = msg;
        this.total = total;
        this.page = page;
        this.data = data;
    }

    public PageResponse(Long total, Integer page, List<T> data) {
        this.code = RtCodeEnum.R_SUCCESS.getCode();
        this.msg = RtCodeEnum.R_SUCCESS.getMessage();
        this.total = total;
        this.page = page;
        this.data = data;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Long getTotal() {
        return total;
    }

    public void setTotal(Long total) {
        this.total = total;
    }

    public Integer getPage() {
        return page;
    }

    public void setPage(Integer page) {
        this.page = page;
    }

    public List<T> getData() {
        return data;
    }

    public void setData(List<T> data) {
        this.data = data;
    }
}
